#include <gmlib/number/mont256.h>
#include <gmlib/number/uint256.h>

#include <stdexcept>
#include <cstring>

using namespace number;

static std::uint8_t  P_data[32]      = {0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
static std::uint8_t  P_SUB2_data[32] = {0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd};
static std::uint8_t  R_data[32]      = {0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
static std::uint8_t  R_POW2_data[32] = {0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03};
static std::uint8_t  N_data[32]      = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};

void test_mont256_sqr()
{
    uint256_t P, P_SUB2, R, R_POW2, N_;
    uint256_from_bytes(P, P_data);
    uint256_from_bytes(P_SUB2, P_SUB2_data);
    uint256_from_bytes(R, R_data);
    uint256_from_bytes(R_POW2, R_POW2_data);
    uint256_from_bytes(N_, N_data);

    Mont256CTX ctx;
    ctx.P = P, ctx.P_SUB2 = P_SUB2;
    ctx.R = R, ctx.R_POW2 = R_POW2;
    ctx.N_ = N_;

    mont256_t    multiplier, product;
    std::uint8_t product_data[32];

    std::uint8_t multiplier0[32] = {0xd2,0x3f,0x08,0x24,0x12,0x8b,0x2f,0x33,0x0c,0x5c,0x7f,0xd0,0xa6,0xa3,0xa4,0x50,0x65,0x13,0x27,0x0e,0x26,0x9e,0x0d,0x37,0xf2,0xa7,0x4d,0xe4,0x52,0xe6,0xb4,0x38};
    std::uint8_t product0[32]    = {0x28,0xae,0x2d,0xf9,0xcd,0x52,0x52,0xb6,0xa0,0xba,0x85,0x9b,0x8e,0x3f,0x7c,0xdc,0xbf,0x2a,0x09,0xd6,0xa3,0xa1,0xb9,0x75,0xf5,0x59,0xab,0x5a,0x58,0x08,0x63,0xbe};
    mont256_from_bytes(&ctx, multiplier, multiplier0);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product0, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier1[32] = {0x36,0xf6,0x75,0xcc,0x81,0xe7,0x4e,0xf5,0xe8,0xe2,0x5d,0x94,0x0e,0xd9,0x04,0x75,0x95,0x31,0x98,0x5d,0x5d,0x9d,0xc9,0xf8,0x18,0x18,0xe8,0x11,0x89,0x2f,0x90,0x2b};
    std::uint8_t product1[32]    = {0xab,0x7b,0x7b,0x3c,0xb9,0xb8,0xfa,0x0f,0xe5,0xd6,0xc4,0x52,0xb8,0x4c,0xdc,0x7a,0x3b,0x5b,0xd9,0x92,0x7d,0x7b,0x03,0x72,0xb6,0xcf,0xdf,0x24,0x0b,0x01,0x5d,0x68};
    mont256_from_bytes(&ctx, multiplier, multiplier1);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product1, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier2[32] = {0x8d,0x11,0x6e,0xce,0x17,0x38,0xf7,0xd9,0x3d,0x9c,0x17,0x24,0x11,0xe2,0x0b,0x8f,0x6b,0x0d,0x54,0x9b,0x6f,0x03,0x67,0x5a,0x16,0x00,0xa3,0x5a,0x09,0x99,0x50,0xd8};
    std::uint8_t product2[32]    = {0x65,0x58,0x63,0x49,0x19,0xea,0xfa,0x41,0x6a,0x95,0xea,0x43,0xf7,0x67,0x19,0xdd,0xcd,0xbd,0xa5,0x51,0xc4,0x98,0x57,0x75,0x3f,0x8e,0x62,0x22,0xc7,0x6f,0x53,0xc7};
    mont256_from_bytes(&ctx, multiplier, multiplier2);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product2, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier3[32] = {0xa1,0x70,0xb3,0x38,0x39,0x26,0x30,0x59,0xf2,0x8c,0x10,0x5d,0x1f,0xb1,0x7c,0x23,0x90,0xc1,0x92,0xcf,0xd3,0xac,0x94,0xaf,0x0f,0x21,0xdd,0xb6,0x6c,0xad,0x4a,0x26};
    std::uint8_t product3[32]    = {0x02,0xe5,0x2a,0x0f,0xe9,0x6f,0x4a,0xb9,0x20,0xf8,0x29,0x9d,0xc0,0x9e,0xb9,0x10,0x2f,0x7f,0xc4,0x27,0xeb,0x48,0x79,0x07,0xec,0xeb,0xd3,0x6c,0x86,0xdb,0x38,0xab};
    mont256_from_bytes(&ctx, multiplier, multiplier3);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product3, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier4[32] = {0x0c,0xb1,0xe2,0x9c,0x65,0x8c,0xda,0x14,0x95,0xe6,0x0a,0xf5,0x93,0xbd,0x04,0xcf,0x0f,0xd6,0x30,0xf1,0xf2,0x9d,0x0d,0xa9,0x95,0x3f,0x48,0xf1,0xa0,0x9f,0x76,0xb5};
    std::uint8_t product4[32]    = {0x04,0xcf,0x82,0x00,0xae,0xc8,0xab,0xfd,0xb7,0xb5,0x02,0x4d,0x90,0x89,0xb8,0xa8,0x92,0x85,0x64,0x9d,0x89,0x67,0x4d,0x20,0x2a,0x67,0xd9,0xf3,0x64,0x10,0x29,0xae};
    mont256_from_bytes(&ctx, multiplier, multiplier4);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product4, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier5[32] = {0x6b,0x4c,0xb2,0x42,0x4a,0x23,0xd5,0x96,0x22,0x17,0xbe,0xad,0xdb,0xc4,0x96,0xcb,0x8e,0x81,0x97,0x3e,0x0b,0xec,0xd7,0xb0,0x38,0x98,0xd1,0x90,0xf9,0xeb,0xda,0xcc};
    std::uint8_t product5[32]    = {0xa0,0x4d,0x39,0xf9,0xe8,0x3b,0x9d,0xbc,0xb8,0xd1,0x6c,0xe8,0xbc,0xc9,0xd6,0x41,0x58,0x8c,0xef,0xd8,0x93,0xf9,0x98,0xa8,0x9b,0xeb,0x5c,0xfd,0x78,0x22,0xfe,0x48};
    mont256_from_bytes(&ctx, multiplier, multiplier5);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product5, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier6[32] = {0xae,0x97,0xba,0x94,0xd0,0xed,0xa8,0x2f,0x8f,0x6d,0x05,0x58,0x4e,0xf8,0xaa,0x38,0x92,0x27,0x66,0x58,0x1e,0x27,0xa1,0xc0,0x8a,0x6a,0x63,0xec,0x24,0xed,0xe6,0xa4};
    std::uint8_t product6[32]    = {0x47,0x8f,0xa8,0x59,0x34,0xfe,0x2f,0xd9,0xd7,0xf2,0x84,0xcd,0x82,0xc5,0x2f,0x0e,0x65,0xa2,0xe3,0x42,0x99,0x7e,0x3c,0x96,0xb2,0xf1,0x95,0xac,0xb9,0xf1,0xe3,0xc5};
    mont256_from_bytes(&ctx, multiplier, multiplier6);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product6, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier7[32] = {0x18,0xf1,0x35,0xd2,0x5f,0x55,0x72,0x03,0x30,0x18,0x50,0xc5,0xa3,0x8f,0xd5,0x47,0x92,0x3a,0x73,0x69,0x94,0xe3,0xbf,0x91,0x1a,0x61,0xdb,0xe2,0x2e,0x44,0x15,0x8b};
    std::uint8_t product7[32]    = {0x96,0x37,0x0f,0xcd,0x29,0xc0,0x04,0x35,0xc3,0x2c,0x92,0x27,0x56,0x1d,0xe5,0xb7,0xd0,0xf9,0xc6,0xc2,0x09,0x54,0x44,0x36,0x1a,0x6d,0x75,0x6f,0x4c,0xd4,0x3c,0x17};
    mont256_from_bytes(&ctx, multiplier, multiplier7);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product7, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier8[32] = {0x7f,0x15,0x05,0x24,0x34,0xb9,0xb5,0xdf,0x9e,0x77,0x69,0xb1,0x0f,0x42,0x05,0xb4,0x90,0x7a,0x70,0xc3,0x10,0x12,0xf0,0x37,0xb6,0x4c,0xe4,0x22,0x8c,0x38,0xfb,0x29};
    std::uint8_t product8[32]    = {0x99,0x1e,0x90,0x4d,0x43,0x08,0xfb,0x58,0x93,0xbb,0xd1,0x37,0x34,0x30,0x8e,0x53,0x0c,0x35,0x2d,0x4b,0x4f,0x1a,0xd1,0xc2,0x36,0x7a,0x4a,0xa7,0xcd,0x06,0xa5,0xe1};
    mont256_from_bytes(&ctx, multiplier, multiplier8);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product8, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier9[32] = {0xec,0x66,0xa7,0x87,0x95,0xe7,0x61,0xd1,0x77,0x31,0xaf,0x10,0x50,0x6b,0xf2,0xef,0xc6,0xf8,0x77,0x18,0x6d,0x76,0xb0,0x7e,0x88,0x1e,0xd1,0x62,0xae,0x2e,0xb1,0x54};
    std::uint8_t product9[32]    = {0xd6,0x92,0x8b,0x7e,0x51,0xb3,0x39,0x80,0xd4,0xff,0xbb,0x37,0xe5,0x21,0x49,0x23,0x28,0x59,0x14,0xff,0xab,0xf7,0xb1,0x80,0xf8,0x2d,0x32,0x51,0xbb,0xfa,0xa9,0x85};
    mont256_from_bytes(&ctx, multiplier, multiplier9);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product9, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier10[32] = {0xc7,0xa2,0xea,0x20,0xb2,0xf1,0x4c,0x94,0x2e,0x05,0x31,0x9a,0xcb,0x5c,0x74,0x27,0x3f,0x98,0xe2,0x77,0x4c,0xbd,0x87,0xad,0x5c,0x90,0xa9,0x58,0x74,0x03,0xe4,0x30};
    std::uint8_t product10[32]    = {0x74,0xee,0x16,0x5a,0x7b,0xa5,0x35,0x06,0x4c,0x3e,0x7c,0xb4,0x85,0x71,0xca,0x33,0x2c,0x72,0x1e,0x09,0x71,0x09,0x3f,0x05,0x0a,0x26,0xdc,0x7b,0xf4,0x2c,0x9d,0x5f};
    mont256_from_bytes(&ctx, multiplier, multiplier10);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product10, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier11[32] = {0x57,0xee,0x05,0xcd,0xe0,0x09,0x02,0xc7,0x7e,0xbf,0xf2,0x06,0x86,0x73,0x47,0x21,0x4c,0xdd,0x20,0x55,0x93,0x0d,0x6e,0xaf,0x14,0xf4,0x73,0x3f,0x3e,0x7d,0x1b,0xfb};
    std::uint8_t product11[32]    = {0x2d,0x09,0x6d,0xb9,0xbe,0xbc,0x17,0x8c,0xae,0x24,0x37,0x3e,0x40,0x18,0x48,0x13,0x81,0xa7,0x52,0x05,0xc1,0x05,0x6b,0x67,0xbb,0x22,0x68,0xa4,0xf2,0x51,0xb0,0xd4};
    mont256_from_bytes(&ctx, multiplier, multiplier11);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product11, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier12[32] = {0x83,0x0e,0x07,0xbc,0x1e,0x39,0x8f,0x10,0x12,0xbd,0x4a,0xce,0xfa,0xec,0xbd,0x38,0x9b,0xe4,0xbc,0xfc,0x49,0xb6,0x4a,0x08,0x72,0xe6,0xcc,0x3a,0xba,0xbc,0xed,0x20};
    std::uint8_t product12[32]    = {0x2c,0x0f,0xe7,0x52,0x2a,0xb5,0xeb,0xa7,0xaa,0x94,0x62,0xd4,0x45,0xd4,0xd3,0xa1,0x9f,0x2c,0x2d,0xbf,0x9a,0x30,0x5f,0xb6,0xe4,0x8e,0x44,0xba,0xa1,0xaf,0x88,0x40};
    mont256_from_bytes(&ctx, multiplier, multiplier12);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product12, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier13[32] = {0x6b,0xf4,0x6c,0x69,0x7d,0x2c,0xaf,0x82,0xee,0xea,0xcb,0xe2,0x26,0xe8,0x75,0x55,0x57,0x90,0xf8,0x2e,0xc1,0xd3,0xfc,0xff,0x2a,0x3a,0xf4,0xd4,0x6b,0x0a,0x18,0xe8};
    std::uint8_t product13[32]    = {0x3b,0xe8,0xc9,0xad,0xb2,0x71,0xf5,0xd1,0xe5,0x01,0x5d,0x5f,0xc2,0xc9,0x1f,0x6b,0x34,0x57,0x5b,0x00,0xe0,0x95,0x67,0xf3,0x79,0x50,0x7d,0x36,0xc6,0x6c,0xdf,0xeb};
    mont256_from_bytes(&ctx, multiplier, multiplier13);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product13, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier14[32] = {0xca,0x02,0x13,0x5e,0x92,0xb1,0xd3,0xf2,0x8e,0xde,0x0d,0x7a,0xc3,0xba,0xea,0x9e,0x13,0xde,0xef,0x86,0xab,0x10,0x31,0xd0,0xf6,0x46,0xe1,0xf4,0x0a,0x09,0x7c,0x97};
    std::uint8_t product14[32]    = {0x8d,0x73,0x4d,0xa1,0x64,0x89,0xcc,0x5e,0xcd,0x6f,0xa3,0xba,0xf2,0xac,0xc5,0xa1,0xea,0xfb,0x1c,0x77,0x3e,0xa2,0x60,0x59,0x5f,0xc6,0xfb,0x6b,0xf3,0x55,0x68,0x0d};
    mont256_from_bytes(&ctx, multiplier, multiplier14);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product14, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier15[32] = {0x7f,0x26,0x14,0x4b,0x98,0x28,0x9f,0xcd,0x59,0xa5,0x4a,0x7b,0xb1,0xfe,0xe0,0x8f,0x57,0x12,0x42,0x42,0x50,0x51,0xc1,0xcc,0xd1,0x7f,0x9a,0xca,0xe0,0x1f,0x50,0x57};
    std::uint8_t product15[32]    = {0xb4,0x00,0x1a,0x35,0x7a,0x7f,0x65,0xe8,0xce,0x35,0x2c,0xfd,0x8a,0xc8,0xf9,0x26,0x0a,0x23,0xe5,0x6d,0x4f,0x72,0xff,0x9c,0xc5,0x48,0xb3,0x47,0xf9,0x18,0xe8,0x49};
    mont256_from_bytes(&ctx, multiplier, multiplier15);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product15, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier16[32] = {0x45,0x1a,0xbd,0x81,0xf1,0xd6,0x9e,0xd6,0x17,0xf5,0xe8,0x37,0xd7,0x08,0x20,0xfe,0x11,0x9a,0x72,0xd1,0x74,0xc9,0xdf,0x6a,0xcc,0x01,0x1c,0xdd,0x94,0x74,0x03,0x1b};
    std::uint8_t product16[32]    = {0x3b,0xf7,0x3b,0xf0,0x6b,0x41,0x6c,0x6b,0x7a,0x63,0x38,0x81,0x8a,0x7c,0xd4,0x8c,0x7e,0xa0,0x7a,0x83,0x61,0x88,0xb3,0x2d,0xb7,0xae,0x07,0xdd,0x33,0x62,0xc6,0xcf};
    mont256_from_bytes(&ctx, multiplier, multiplier16);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product16, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier17[32] = {0x4f,0x42,0x6d,0xcb,0xb3,0x94,0xfb,0x36,0xbb,0x2d,0x42,0x0f,0x0f,0x88,0x08,0x0b,0x10,0xa3,0xd6,0xb2,0xaa,0x05,0xe1,0x1a,0xb2,0x71,0x59,0x45,0x79,0x5e,0x82,0x29};
    std::uint8_t product17[32]    = {0xd8,0xe2,0x9c,0xb0,0x12,0xec,0xfe,0xc1,0x29,0xa5,0x96,0xd3,0x5a,0x3e,0x84,0x6a,0xe2,0xd3,0x2a,0x0d,0x3f,0x74,0x22,0x49,0xa4,0xd1,0xd6,0x71,0x81,0xba,0x85,0x40};
    mont256_from_bytes(&ctx, multiplier, multiplier17);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product17, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier18[32] = {0xb7,0x74,0xeb,0x52,0x48,0xdb,0x40,0xaf,0x72,0x15,0x83,0x70,0xd2,0x69,0xa9,0xa5,0xae,0x65,0x8f,0x33,0xfe,0x3b,0x89,0x0b,0x93,0xf4,0x48,0xb3,0xa5,0xaa,0x3c,0x81};
    std::uint8_t product18[32]    = {0x86,0xc1,0x71,0x2c,0xc2,0x0b,0x19,0x92,0x5e,0x82,0x0d,0x55,0x57,0x23,0xb3,0x54,0xbf,0xf7,0x09,0xcf,0xff,0xfc,0xc2,0x7b,0xf7,0xac,0xc8,0x99,0x2d,0x8d,0xeb,0x5a};
    mont256_from_bytes(&ctx, multiplier, multiplier18);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product18, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier19[32] = {0x5a,0xff,0xb2,0x29,0x76,0x31,0xa9,0x92,0xf0,0xce,0x58,0x35,0x05,0xc6,0xaf,0x07,0x58,0xd5,0x56,0x3d,0xab,0x2c,0xd3,0x1e,0xe3,0x15,0x12,0x88,0x62,0xc3,0x3a,0x4f};
    std::uint8_t product19[32]    = {0x12,0x0e,0x5d,0x47,0x69,0x49,0xe9,0xbf,0x91,0xc0,0x29,0x4a,0x52,0x03,0xce,0x58,0xa4,0x4c,0x56,0x93,0xe1,0xf2,0x23,0xd6,0xad,0x90,0x61,0xce,0x11,0xe2,0x73,0x1f};
    mont256_from_bytes(&ctx, multiplier, multiplier19);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product19, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier20[32] = {0x49,0x95,0x23,0x99,0xc4,0xaa,0xea,0xc1,0x37,0xdc,0x76,0xfb,0x0f,0x17,0xa3,0x00,0x7e,0x62,0xaa,0x0a,0x1d,0xf9,0xfd,0x78,0x9c,0x65,0x39,0x38,0x2b,0x05,0x37,0xe6};
    std::uint8_t product20[32]    = {0xe8,0x47,0x3e,0xf0,0x76,0x2c,0x9a,0x05,0xc0,0x38,0x0b,0x4d,0x54,0x31,0x6c,0x78,0x0b,0x78,0x8f,0x14,0x20,0xd0,0xad,0xbb,0x12,0xfd,0xab,0xbc,0xca,0x5e,0xd6,0x81};
    mont256_from_bytes(&ctx, multiplier, multiplier20);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product20, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier21[32] = {0x7f,0x1b,0x10,0x3c,0xdf,0x15,0x82,0xb0,0xea,0xb4,0x77,0xd2,0x64,0x15,0x47,0x9c,0x65,0xdc,0x9f,0x50,0x3f,0x63,0xaf,0x83,0xbd,0x05,0x61,0xe6,0x21,0x1c,0x70,0xcf};
    std::uint8_t product21[32]    = {0x0c,0xfd,0xc3,0x7e,0xd0,0x0e,0xd3,0x53,0xee,0x53,0x53,0x10,0x5d,0x0d,0xc7,0x33,0x46,0x7d,0x55,0xf1,0x0c,0x88,0xdc,0x5e,0xe2,0x16,0xc2,0x86,0x11,0x9a,0xfb,0x43};
    mont256_from_bytes(&ctx, multiplier, multiplier21);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product21, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier22[32] = {0x23,0x0d,0x97,0x7e,0xe2,0x25,0x71,0x59,0x47,0x20,0x77,0x1f,0x8c,0xa8,0x18,0x11,0x66,0xd2,0x28,0x76,0x72,0xfd,0xf2,0x02,0x2a,0x96,0xfb,0x1a,0x14,0xa0,0xf9,0xe7};
    std::uint8_t product22[32]    = {0xb4,0x0f,0x1f,0xcc,0xe8,0x11,0x2b,0x1b,0xa0,0xd4,0xcb,0xc7,0x0b,0xa6,0xf2,0x12,0xc1,0x93,0x82,0xda,0xc7,0x1a,0x82,0x88,0xf1,0x15,0x89,0xee,0xaa,0x31,0x4d,0x1b};
    mont256_from_bytes(&ctx, multiplier, multiplier22);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product22, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier23[32] = {0xfc,0x89,0x1b,0x4a,0x6a,0x50,0xdf,0x4d,0xb4,0xd6,0x6a,0x3a,0x47,0x46,0x9a,0x4d,0x8c,0xdb,0x30,0x5f,0xdd,0x2e,0x16,0x09,0x6e,0x36,0xaa,0xb0,0xd1,0xbc,0x52,0xd9};
    std::uint8_t product23[32]    = {0x5d,0xbe,0xf2,0xfe,0x89,0x71,0xcc,0x41,0x28,0xb5,0x08,0xd2,0x32,0xe1,0x60,0x0e,0x7a,0x30,0xd8,0x33,0xf0,0xd0,0xd0,0xe1,0x46,0xb0,0xd2,0x38,0x3a,0x5c,0x9c,0xca};
    mont256_from_bytes(&ctx, multiplier, multiplier23);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product23, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier24[32] = {0x15,0x3e,0x7c,0x2a,0x26,0xa2,0xc0,0xbd,0x3b,0x12,0x87,0xff,0xf5,0x2d,0xdf,0x5d,0x61,0x64,0x99,0xc9,0xe2,0x5a,0x76,0x05,0xae,0xc6,0xf0,0x24,0x5b,0xd8,0x6d,0x40};
    std::uint8_t product24[32]    = {0x73,0x02,0x3f,0x74,0xe0,0x1e,0x30,0x2f,0x4c,0xe3,0xb9,0xa5,0x10,0xe8,0x0b,0x41,0xfc,0x4b,0xd8,0x45,0xfd,0x50,0xe0,0x9e,0xbe,0x3b,0xd7,0xc1,0xf6,0x3e,0x8b,0x37};
    mont256_from_bytes(&ctx, multiplier, multiplier24);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product24, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier25[32] = {0xd4,0xc2,0x8c,0x2e,0x7c,0x26,0x84,0x7f,0x03,0x16,0x90,0x9e,0x3b,0xbb,0xe9,0xea,0xa8,0x94,0x8c,0x89,0x3b,0x61,0x86,0x76,0x26,0xbb,0x7d,0xbd,0x2d,0x1c,0x9a,0xf0};
    std::uint8_t product25[32]    = {0x57,0x7d,0x57,0x99,0x9d,0x76,0x7e,0x24,0x49,0xcc,0x42,0xaa,0xe9,0xc5,0x64,0x53,0x78,0xf2,0xba,0x5a,0x30,0x36,0x7a,0x5f,0x38,0xa0,0xe1,0xbf,0xe6,0x72,0x8d,0x6c};
    mont256_from_bytes(&ctx, multiplier, multiplier25);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product25, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier26[32] = {0x88,0xda,0xf4,0x01,0x6b,0x40,0x13,0xef,0x25,0x4b,0x0c,0x4e,0x01,0x0c,0x47,0x59,0x48,0x2c,0x9c,0xbc,0x43,0x43,0x5c,0xc5,0x2e,0xae,0x05,0xcf,0x96,0xd0,0xcc,0x5f};
    std::uint8_t product26[32]    = {0x71,0xf6,0x03,0x60,0x1b,0x66,0x0d,0xc9,0xca,0x92,0xfc,0xb7,0x6a,0x5b,0xb1,0x51,0x47,0x99,0x1d,0x36,0xfa,0x4a,0x08,0x14,0x86,0x02,0x03,0x92,0xb0,0x17,0x78,0xaf};
    mont256_from_bytes(&ctx, multiplier, multiplier26);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product26, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier27[32] = {0xdb,0xf4,0xa8,0xb2,0xb0,0xc4,0x31,0x2d,0x20,0x20,0x36,0x26,0xf3,0xfe,0x39,0xc0,0x51,0x90,0x88,0xf5,0x90,0xfb,0xbd,0x11,0x9c,0x1c,0xaa,0xf7,0x5e,0x87,0x66,0xed};
    std::uint8_t product27[32]    = {0x62,0xbd,0x46,0x12,0x3c,0x5a,0x43,0x1b,0xbb,0xa1,0xb9,0x0c,0xc0,0x32,0x3b,0xf3,0x74,0xf4,0x0e,0xda,0x39,0x4f,0x92,0x67,0x96,0x33,0x89,0xfd,0xdb,0x19,0x52,0xe8};
    mont256_from_bytes(&ctx, multiplier, multiplier27);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product27, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier28[32] = {0x74,0xe6,0x9a,0x5d,0x0d,0xd2,0x7a,0x65,0xbd,0x62,0x88,0x81,0xad,0x1b,0x72,0xdb,0xa7,0xab,0xe1,0xc2,0x9e,0x1a,0x8e,0xf4,0xf3,0x41,0xe0,0x7a,0x83,0xf7,0x3f,0x16};
    std::uint8_t product28[32]    = {0x16,0x9b,0x35,0xe3,0xa8,0xb4,0xe3,0xdc,0xde,0x56,0x53,0xb3,0x5b,0x4d,0xfb,0x39,0xd0,0x74,0x86,0x53,0x5f,0x1d,0x29,0xd0,0xd4,0xb7,0x7d,0xfd,0x06,0x56,0x11,0x8b};
    mont256_from_bytes(&ctx, multiplier, multiplier28);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product28, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier29[32] = {0x8f,0x2c,0x6e,0xc8,0xcc,0x41,0x69,0xa3,0xae,0x3a,0x2b,0x7f,0xdf,0xe0,0x18,0x93,0xf3,0xae,0xd0,0xb6,0xc7,0xac,0x14,0x91,0xde,0xf8,0x83,0x34,0xe6,0x47,0xcb,0x8f};
    std::uint8_t product29[32]    = {0x9a,0xe3,0x20,0x7d,0x8f,0x42,0x32,0xa0,0xcc,0xe6,0xf1,0x1a,0x1e,0x2b,0x93,0x3e,0xe4,0x4c,0x8e,0xd0,0x31,0x76,0xfd,0x7f,0x12,0xab,0x17,0xe3,0x56,0x98,0xee,0xa4};
    mont256_from_bytes(&ctx, multiplier, multiplier29);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product29, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier30[32] = {0x66,0x83,0x68,0x86,0xa2,0x60,0xcd,0x0b,0x7b,0x45,0x14,0x5c,0x1a,0x81,0x68,0x2c,0x64,0xe5,0x0c,0xad,0x66,0x23,0x7a,0x04,0x65,0xe7,0xe4,0x23,0x64,0x72,0xf1,0xa3};
    std::uint8_t product30[32]    = {0x52,0xd5,0x64,0xc7,0x6f,0x8b,0xa9,0xde,0xde,0x84,0x88,0xf4,0x0e,0x47,0x87,0x5a,0xbf,0xe8,0x4e,0x1a,0x86,0xf0,0x79,0x7f,0xbe,0x94,0x6d,0xd2,0x90,0x4f,0x43,0x04};
    mont256_from_bytes(&ctx, multiplier, multiplier30);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product30, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier31[32] = {0x1c,0x24,0x42,0xf9,0x29,0x8c,0xb3,0xa5,0x70,0xcc,0xec,0x31,0x35,0x71,0x81,0x0a,0xfc,0x13,0x2d,0x0d,0x11,0x3d,0xb1,0x7d,0x30,0xcb,0xc9,0x7d,0x0f,0xef,0x79,0x28};
    std::uint8_t product31[32]    = {0x83,0xc7,0x1e,0xe4,0x17,0x53,0x89,0xa2,0xc9,0x0b,0xe4,0xdf,0xa8,0x34,0x15,0x99,0x9a,0x57,0x3c,0xe8,0xd0,0x20,0x1e,0x6f,0xc2,0x55,0xbf,0xe5,0xd0,0xd0,0x61,0xf7};
    mont256_from_bytes(&ctx, multiplier, multiplier31);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product31, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier32[32] = {0x89,0x5f,0xd7,0xb3,0x26,0xb9,0x4c,0x7f,0x91,0x18,0xbb,0x16,0x00,0x0f,0x49,0xc8,0x1a,0x35,0x8c,0xa0,0x0d,0x75,0x98,0x5d,0x99,0xc9,0x43,0x09,0x57,0x0d,0xc1,0x95};
    std::uint8_t product32[32]    = {0x68,0xbb,0xba,0xe0,0x98,0x1d,0x95,0x54,0x77,0x79,0x40,0x6d,0x38,0xb3,0x9b,0xb6,0x0e,0xf1,0x7c,0x3f,0xa9,0xda,0xc3,0x6d,0xe9,0x58,0xb3,0xaa,0xd1,0x4d,0xc4,0x40};
    mont256_from_bytes(&ctx, multiplier, multiplier32);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product32, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier33[32] = {0x35,0x3c,0x63,0x1c,0xdf,0xd4,0x3f,0x37,0x12,0x00,0x33,0x9d,0x06,0x87,0x39,0xfa,0x9d,0x1d,0xe2,0xa0,0x5d,0x15,0x8a,0x2f,0xf2,0xee,0x4e,0x45,0x19,0xf9,0x91,0x9c};
    std::uint8_t product33[32]    = {0x7b,0xc6,0x62,0x02,0x41,0xec,0x4d,0x11,0x79,0x6f,0x37,0xee,0xb4,0x64,0xf5,0x3b,0x85,0x75,0x66,0x91,0x9a,0x3d,0x9d,0x7e,0x27,0x84,0xef,0x55,0xa2,0xb9,0x54,0x7a};
    mont256_from_bytes(&ctx, multiplier, multiplier33);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product33, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier34[32] = {0x9a,0x2e,0xf8,0x0f,0x58,0xee,0x85,0x71,0xf4,0x99,0x8d,0x7c,0x40,0x93,0xf6,0xde,0xa2,0x68,0xaa,0x87,0x26,0x07,0x67,0x9d,0x60,0x50,0x91,0x4a,0x9d,0x33,0xa0,0x1c};
    std::uint8_t product34[32]    = {0x05,0x63,0x61,0x31,0xe1,0xdb,0x78,0xde,0x22,0xbd,0x0f,0x64,0x69,0xc2,0x2d,0x02,0xcc,0x92,0x96,0x39,0x48,0xa6,0x5c,0x68,0xc6,0x21,0xb0,0x85,0x92,0xf6,0xc6,0xdd};
    mont256_from_bytes(&ctx, multiplier, multiplier34);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product34, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier35[32] = {0xfa,0x52,0x9b,0xa3,0xfe,0x3b,0xfa,0xda,0x7c,0xf2,0x07,0x24,0xd9,0x53,0xee,0x26,0x1d,0x87,0xce,0xc3,0x1f,0x72,0x96,0xab,0x79,0x61,0xfd,0x92,0x5d,0x39,0xd0,0xa8};
    std::uint8_t product35[32]    = {0x2b,0x8b,0xbf,0x79,0x90,0xb2,0x7b,0x7a,0xe6,0xe5,0x1b,0xaf,0xdf,0x8f,0xff,0x56,0x4c,0x40,0xc8,0xf0,0x09,0xed,0xc6,0x83,0xc7,0x5d,0x73,0x01,0xc1,0x79,0xe3,0x0a};
    mont256_from_bytes(&ctx, multiplier, multiplier35);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product35, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier36[32] = {0xbf,0xea,0xa1,0x55,0x1a,0x28,0xf7,0xb3,0x24,0xe4,0xe2,0x5a,0x15,0xfc,0x89,0x9e,0x4f,0xd5,0x8d,0xbe,0x7b,0xdc,0x96,0x8b,0x7a,0xfb,0x2c,0x68,0x77,0x4b,0x15,0xd7};
    std::uint8_t product36[32]    = {0xd7,0x9d,0x5e,0x56,0xe9,0x62,0xb0,0xe7,0xbc,0xb6,0x61,0xc2,0x04,0xd8,0xe0,0xd9,0xbf,0x79,0x57,0x35,0xd4,0x12,0xd9,0x10,0x91,0xeb,0xc2,0x1f,0xf8,0x8b,0x2e,0x30};
    mont256_from_bytes(&ctx, multiplier, multiplier36);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product36, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier37[32] = {0x84,0x2e,0x7f,0xc2,0x29,0x54,0x0a,0x6e,0xb1,0x2a,0xa1,0xf6,0xd4,0x2f,0xdd,0xbb,0x7a,0x86,0xf7,0xa2,0x43,0xc7,0x1b,0x9a,0xbd,0x87,0xa8,0x65,0x57,0xb6,0xfb,0x7e};
    std::uint8_t product37[32]    = {0xdc,0x7b,0x1a,0x99,0x96,0x79,0xf6,0xd0,0x12,0x3b,0x38,0x36,0x3a,0x76,0x4b,0x88,0x67,0x01,0x8b,0x1f,0xb1,0x03,0xc2,0xe5,0xb3,0x6d,0xce,0x38,0xfb,0xdc,0xb7,0x90};
    mont256_from_bytes(&ctx, multiplier, multiplier37);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product37, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier38[32] = {0xb0,0xa8,0x44,0xe5,0x25,0x87,0xbe,0x6b,0x5c,0x9b,0xcf,0x35,0x87,0x3b,0xe0,0x78,0xf3,0xb7,0xa5,0x0d,0xf3,0x73,0xca,0x53,0x34,0x88,0xf8,0x76,0x05,0xe9,0x99,0xf3};
    std::uint8_t product38[32]    = {0x4f,0x05,0x45,0xd2,0x98,0x9c,0x7b,0xf4,0xcf,0x5c,0x7d,0xb5,0x5b,0xaf,0xb4,0xd9,0xef,0x46,0x55,0x49,0xb1,0xd9,0xff,0xbb,0xa5,0xfc,0x0c,0xa1,0xcb,0x51,0x65,0xb4};
    mont256_from_bytes(&ctx, multiplier, multiplier38);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product38, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier39[32] = {0xa4,0x96,0x36,0xa2,0xfa,0x7f,0x0e,0xab,0x4c,0x4f,0x9b,0x06,0x87,0x32,0x2e,0x25,0xc2,0x15,0xa8,0x2a,0x06,0xec,0x41,0xad,0xea,0x05,0x75,0x43,0x8b,0x0d,0x59,0x0b};
    std::uint8_t product39[32]    = {0x25,0x93,0x05,0xac,0x29,0x63,0x69,0xd5,0xc4,0x42,0x68,0x1c,0x1f,0xbf,0xb2,0x1c,0x35,0x8e,0x1e,0x8e,0x1a,0x32,0x79,0x33,0x71,0x7e,0x4f,0x94,0x44,0x75,0x9c,0x15};
    mont256_from_bytes(&ctx, multiplier, multiplier39);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product39, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier40[32] = {0xe8,0x83,0xa1,0xd4,0x5d,0xe0,0x09,0x97,0x84,0xb5,0xa8,0x18,0x42,0xd8,0x72,0x08,0xd8,0x6f,0x40,0xf6,0xb2,0x39,0xf3,0xc7,0x17,0x4c,0x77,0xa2,0xdd,0x02,0xde,0x92};
    std::uint8_t product40[32]    = {0xa3,0x5b,0x5a,0x35,0xb2,0x2d,0x74,0x72,0xf5,0x0e,0xa6,0x2f,0x70,0x21,0x7a,0x21,0x85,0x70,0xc7,0xc6,0x4f,0x07,0x7e,0x1b,0xf4,0xce,0x84,0xe6,0xa9,0x07,0x4d,0xb8};
    mont256_from_bytes(&ctx, multiplier, multiplier40);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product40, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier41[32] = {0x80,0xb0,0xc0,0x8b,0xc7,0x70,0x24,0x20,0x8a,0xa4,0x24,0x8c,0x88,0x57,0xf9,0xa4,0x39,0x08,0xf2,0x27,0xc5,0x9d,0xb9,0x16,0x5b,0x0e,0xe7,0x6f,0x2a,0xc3,0x44,0x46};
    std::uint8_t product41[32]    = {0x52,0x4c,0x48,0x3b,0x16,0x25,0x1a,0xbe,0x7b,0xe7,0xc8,0x90,0xb0,0x2b,0xcd,0x1e,0x9e,0x3c,0xf1,0x36,0xa9,0x89,0x84,0xef,0x88,0x6e,0x10,0x98,0xb5,0xcb,0x78,0x95};
    mont256_from_bytes(&ctx, multiplier, multiplier41);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product41, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier42[32] = {0xc2,0x21,0x6b,0x02,0xfc,0x24,0x1d,0x0b,0xc9,0xd4,0x88,0xb1,0xcf,0xbf,0x33,0x60,0x9c,0xfc,0x86,0x52,0x39,0x19,0x42,0x42,0xa2,0xed,0xdb,0xbd,0x54,0x64,0xec,0xc2};
    std::uint8_t product42[32]    = {0x37,0x5b,0x32,0x27,0x9e,0x95,0xfb,0x6f,0xe7,0x9d,0x5b,0xfe,0xd6,0xd5,0x17,0x6d,0x07,0x19,0x19,0x0d,0xf7,0x9b,0x9d,0x3c,0xad,0x10,0xc4,0x39,0x53,0x83,0xa4,0x97};
    mont256_from_bytes(&ctx, multiplier, multiplier42);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product42, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier43[32] = {0xcd,0xa6,0xc6,0xfd,0xbd,0x68,0x51,0x67,0x66,0x93,0x40,0x36,0xd1,0x7e,0x44,0x97,0x3d,0x48,0x82,0xa5,0xce,0x5b,0x2a,0x92,0x31,0xf5,0x17,0x07,0xda,0x45,0xe1,0x8a};
    std::uint8_t product43[32]    = {0xf7,0x30,0x47,0x8f,0xb9,0x3c,0xf2,0xd1,0x9a,0xd2,0x7b,0xb8,0x2d,0x44,0x44,0xf8,0x75,0x39,0x73,0x8e,0xb2,0x61,0x55,0x78,0xe1,0x2c,0x39,0xb7,0x4f,0x0f,0xc2,0xaf};
    mont256_from_bytes(&ctx, multiplier, multiplier43);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product43, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier44[32] = {0xfd,0x56,0xa9,0x26,0x07,0x6b,0x3e,0x36,0xbb,0x23,0x13,0xf5,0x5b,0x06,0x25,0x8e,0x7e,0x26,0xf3,0x6a,0x84,0x83,0xf8,0xb8,0x33,0x2d,0xd3,0x31,0x3a,0x0b,0x99,0x65};
    std::uint8_t product44[32]    = {0xe9,0xac,0x73,0x3d,0xe6,0x4e,0x5d,0x1e,0x60,0x47,0xb1,0xae,0x27,0xbf,0x33,0x5e,0x3d,0xa7,0xaa,0x14,0x7c,0x88,0x5e,0x08,0x01,0x9b,0x19,0xfb,0xbd,0x8b,0x46,0x10};
    mont256_from_bytes(&ctx, multiplier, multiplier44);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product44, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier45[32] = {0x9a,0xea,0x64,0x29,0xb1,0x49,0x1e,0x24,0x31,0x92,0xb7,0x04,0x42,0x59,0x40,0x52,0x78,0xe4,0xb9,0x8d,0x47,0x87,0xf9,0x3b,0xca,0x44,0xeb,0x86,0x07,0x26,0xe2,0x5c};
    std::uint8_t product45[32]    = {0xff,0x0c,0x63,0xb9,0xe3,0x31,0x54,0xa2,0x88,0x7b,0x76,0x8a,0x51,0x4a,0xe0,0x1a,0x08,0xc7,0xdb,0x0e,0x76,0xb9,0x78,0x28,0xcd,0xb6,0xa9,0x1f,0x9e,0x53,0x00,0xf2};
    mont256_from_bytes(&ctx, multiplier, multiplier45);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product45, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier46[32] = {0x59,0x7a,0x1e,0xcf,0xfc,0xf0,0x0f,0xec,0xb9,0x1e,0xe9,0xe5,0xef,0xe0,0x9f,0x07,0xce,0xfe,0x2a,0x1f,0x72,0x7d,0x83,0x49,0x58,0x22,0xcb,0x77,0xf4,0xde,0x2c,0x08};
    std::uint8_t product46[32]    = {0x6f,0x94,0xee,0x93,0x67,0x8c,0x77,0x7e,0xed,0xa7,0xb6,0x69,0xc0,0xc4,0x66,0xdc,0xd2,0x81,0x29,0x77,0xc9,0xee,0x13,0x5c,0x02,0x6f,0x6d,0xf3,0x90,0xf2,0xc2,0x90};
    mont256_from_bytes(&ctx, multiplier, multiplier46);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product46, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier47[32] = {0x78,0x57,0x29,0x76,0x3a,0x12,0x91,0x7c,0x1a,0x26,0xf8,0x89,0x38,0x70,0x38,0x00,0x14,0x9e,0x25,0x9b,0x5d,0x58,0xc7,0x05,0xf9,0x79,0xd0,0x4a,0xf4,0x7a,0xeb,0xdd};
    std::uint8_t product47[32]    = {0x8d,0x5a,0xe5,0x32,0xce,0x3c,0xc9,0xd7,0xf5,0x9e,0x65,0x1a,0xb4,0xe8,0x97,0x94,0x86,0xaa,0xf8,0x64,0x6c,0x44,0x38,0xa2,0xf8,0xab,0x27,0xa6,0x9e,0xb4,0xc7,0x59};
    mont256_from_bytes(&ctx, multiplier, multiplier47);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product47, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier48[32] = {0x9c,0x3a,0x23,0xcd,0xe6,0x7a,0x9b,0x75,0xfc,0x39,0x47,0x24,0x9f,0xc2,0xd0,0xa1,0x7b,0x8f,0x2a,0xb5,0x34,0x51,0xd0,0x13,0x56,0x75,0xf6,0xad,0x32,0x5b,0x55,0xdd};
    std::uint8_t product48[32]    = {0xc5,0x58,0x89,0x71,0xb2,0x4b,0x8b,0x62,0x32,0x90,0x41,0x15,0xe7,0xc5,0xfb,0x72,0x79,0xe6,0xbb,0x71,0x1e,0xea,0x04,0xe3,0x4f,0xe8,0x8f,0x00,0xd5,0x5b,0xb3,0x9c};
    mont256_from_bytes(&ctx, multiplier, multiplier48);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product48, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier49[32] = {0xa4,0xa4,0x5e,0xff,0xcc,0xb5,0x73,0xd9,0x58,0x10,0xd6,0x0e,0xa7,0x29,0x91,0xb9,0xe8,0xc1,0x47,0x43,0x7a,0xbe,0xc5,0x39,0x00,0x7d,0x10,0x34,0xd7,0x26,0xc8,0x6b};
    std::uint8_t product49[32]    = {0xe8,0x67,0x9f,0xa3,0xf8,0x35,0x77,0x53,0x8d,0x14,0xd8,0x90,0xd6,0x2a,0x7f,0x54,0xdf,0x44,0xf2,0x25,0x7e,0xc5,0xe9,0x74,0xca,0x53,0xcb,0xc9,0x84,0x20,0xae,0x5c};
    mont256_from_bytes(&ctx, multiplier, multiplier49);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product49, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier50[32] = {0xb6,0x24,0x67,0x71,0xc8,0x45,0x00,0x70,0x63,0x77,0x14,0x07,0xe8,0xe7,0x27,0x89,0x1e,0xb2,0x01,0x09,0xa9,0x1c,0x24,0x39,0xd5,0xab,0x8b,0x4d,0x15,0xb4,0x0a,0xeb};
    std::uint8_t product50[32]    = {0x58,0x6e,0xd2,0x81,0xc0,0xf3,0xee,0xf0,0x28,0x12,0xbf,0x0a,0x58,0xf6,0x07,0xe5,0x5b,0x68,0xf9,0xf4,0x36,0x35,0x55,0xe2,0x66,0x7f,0xa0,0x78,0x1b,0x11,0xb4,0x64};
    mont256_from_bytes(&ctx, multiplier, multiplier50);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product50, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier51[32] = {0xa2,0xc6,0x8e,0x45,0xca,0x04,0xc7,0x9f,0x6f,0x15,0xb6,0xad,0x2d,0xb3,0x99,0x7f,0xe3,0x96,0x39,0xbe,0x7a,0x60,0x5a,0x91,0x33,0x06,0x98,0xa1,0xc0,0x09,0x34,0x92};
    std::uint8_t product51[32]    = {0x66,0x20,0x13,0x9c,0x9c,0xbd,0x68,0x3b,0x0c,0x94,0x47,0xb3,0x47,0xc2,0xff,0xf7,0x49,0xd8,0x5c,0x8b,0x88,0xf5,0x1c,0xaa,0x44,0x1f,0x92,0x35,0xfe,0x0d,0x9f,0x9e};
    mont256_from_bytes(&ctx, multiplier, multiplier51);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product51, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier52[32] = {0x76,0x91,0xb0,0x6f,0x65,0x55,0xab,0xfe,0xb8,0xc9,0x81,0x7a,0xf8,0xbe,0x88,0x31,0xf2,0x37,0xe4,0x5a,0xcd,0x02,0xc5,0xe1,0x16,0x35,0x3d,0x03,0x55,0x1f,0xd8,0xf9};
    std::uint8_t product52[32]    = {0xc4,0x09,0x13,0x54,0xfb,0xa7,0xde,0xe7,0xe0,0x0f,0x46,0x2a,0x73,0x0e,0x99,0x51,0x3f,0x96,0x18,0x62,0xe6,0x6f,0x84,0x4c,0x96,0x01,0x15,0x1e,0x7c,0x34,0xec,0xbe};
    mont256_from_bytes(&ctx, multiplier, multiplier52);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product52, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier53[32] = {0xfe,0x3c,0x9c,0x8f,0x2b,0x85,0x5c,0x1f,0x28,0xaa,0xca,0x51,0xb9,0x8c,0x67,0xc2,0x15,0xbd,0x44,0x8f,0xf2,0x61,0x49,0xed,0xbe,0x4c,0x5c,0xe6,0x66,0xc1,0x49,0x4e};
    std::uint8_t product53[32]    = {0xff,0xc9,0x66,0x8e,0xe1,0xe7,0x7f,0xd4,0x4d,0xe4,0x3f,0x80,0x63,0xd7,0x9b,0xd4,0xfe,0x20,0xf7,0x3b,0xb6,0x4d,0x78,0xa1,0x74,0xf5,0x6c,0xb9,0xc4,0xb5,0xfc,0x94};
    mont256_from_bytes(&ctx, multiplier, multiplier53);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product53, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier54[32] = {0xa7,0xe6,0x52,0x9b,0xce,0x76,0xe9,0xf4,0x77,0x21,0x6e,0x9e,0xe7,0xa4,0x63,0x09,0x97,0x3f,0x79,0x86,0x26,0xb1,0xcf,0xfc,0x07,0x0d,0x71,0x09,0x20,0x85,0x96,0x34};
    std::uint8_t product54[32]    = {0x21,0xb3,0x71,0xd4,0x79,0xb2,0x4b,0x66,0x8c,0xb4,0x80,0x65,0x04,0x3d,0x8e,0x3f,0x56,0x05,0x3b,0x1f,0x36,0x30,0x03,0x96,0xa7,0x62,0x4f,0x61,0x82,0xe4,0x81,0x08};
    mont256_from_bytes(&ctx, multiplier, multiplier54);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product54, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier55[32] = {0xef,0xfd,0xde,0xea,0xa8,0x42,0xbc,0x19,0x79,0x6f,0x74,0xad,0xfa,0xf5,0x54,0x96,0x98,0x8a,0xf3,0xfb,0xd3,0x96,0x30,0xd6,0x9c,0x90,0x11,0xef,0x25,0x6b,0xad,0xf9};
    std::uint8_t product55[32]    = {0x72,0x2f,0x87,0x57,0x23,0x32,0x9f,0x00,0x43,0x43,0x67,0x4d,0x74,0xfe,0x65,0xb9,0x64,0xa1,0x29,0x2b,0x99,0x5a,0xfe,0x23,0x9b,0xe4,0xb8,0xd8,0xf4,0x21,0xf7,0x53};
    mont256_from_bytes(&ctx, multiplier, multiplier55);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product55, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier56[32] = {0xcc,0xa2,0xa9,0x2b,0x03,0xa5,0x6c,0xc1,0x05,0x7a,0x40,0xb2,0x21,0x88,0x28,0x7e,0x8c,0x5c,0x71,0x5f,0x8c,0x74,0xfc,0x1e,0x27,0xe9,0xe0,0x6f,0x59,0xb4,0x4e,0x92};
    std::uint8_t product56[32]    = {0x5a,0xb0,0xdf,0xd6,0x26,0x5e,0x56,0x40,0x99,0x0c,0x35,0x7c,0x22,0x43,0x5c,0x0c,0x21,0xb9,0x5e,0x5b,0x45,0xab,0xa2,0xda,0x8d,0xf4,0xc2,0xee,0x63,0x1e,0x78,0xcb};
    mont256_from_bytes(&ctx, multiplier, multiplier56);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product56, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier57[32] = {0x23,0xa5,0xef,0x88,0xef,0x02,0x09,0x0b,0xbf,0xde,0xfc,0x15,0x86,0xce,0x03,0xf9,0x1a,0x4f,0x44,0xf9,0xa6,0x51,0x14,0x45,0xb9,0xf3,0x63,0x5c,0xf8,0x8c,0x42,0x2b};
    std::uint8_t product57[32]    = {0xa9,0x25,0x5e,0x69,0xce,0xe6,0x08,0xd3,0x8a,0x95,0x7d,0xdc,0x93,0x17,0x5a,0xb5,0xcd,0x80,0x36,0xba,0x6d,0xd1,0xac,0xbe,0x51,0xc1,0xaf,0x03,0x77,0xda,0xf4,0x85};
    mont256_from_bytes(&ctx, multiplier, multiplier57);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product57, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier58[32] = {0x07,0x2a,0x98,0xd2,0x36,0x06,0xde,0xfc,0xdf,0xb8,0x5c,0x0d,0xd3,0x7e,0xe9,0x15,0x31,0xde,0xc4,0xf4,0xdf,0x2a,0x8b,0x79,0xfc,0x8e,0x80,0xb3,0x6f,0x0e,0x22,0x89};
    std::uint8_t product58[32]    = {0xe8,0x53,0x05,0x99,0x11,0x82,0xd3,0x8a,0x1b,0xc2,0xdd,0xe5,0x1b,0x9c,0xa5,0xb5,0xd0,0xf4,0x54,0xe1,0x5f,0x08,0xb2,0x45,0x91,0xf4,0x8c,0x78,0x3d,0x99,0x93,0xa9};
    mont256_from_bytes(&ctx, multiplier, multiplier58);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product58, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier59[32] = {0x53,0x74,0x09,0x02,0x96,0x20,0xbf,0x0d,0xc3,0x80,0x84,0xa0,0x3d,0x93,0xfd,0x4c,0x80,0x4c,0x25,0xd6,0x4a,0xff,0xdc,0xd1,0x36,0x78,0xbc,0x8d,0x40,0x78,0x3f,0x0a};
    std::uint8_t product59[32]    = {0xa6,0x1f,0xe9,0x84,0xc2,0x61,0x71,0x72,0x40,0x76,0xde,0x90,0x0e,0x10,0x6a,0xee,0x48,0x0a,0x37,0x73,0x81,0xd6,0x0a,0xc7,0xa0,0x09,0xcd,0x5a,0xf6,0x78,0x1a,0xe8};
    mont256_from_bytes(&ctx, multiplier, multiplier59);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product59, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier60[32] = {0xbd,0x6b,0x88,0x1a,0xe8,0xf6,0xe0,0xbd,0x0f,0x97,0x70,0x44,0x21,0x8e,0x0b,0x7b,0xd5,0x8d,0xcd,0xb4,0x6b,0x44,0x68,0x06,0x8b,0x5a,0xb3,0xee,0x42,0x65,0xbb,0x31};
    std::uint8_t product60[32]    = {0xaf,0x86,0x07,0x0b,0x8e,0x85,0x16,0x8f,0xb0,0xb5,0x94,0x1a,0x45,0x9b,0x73,0x84,0xc7,0x0b,0x0c,0xaa,0xbe,0x3c,0x93,0xfd,0xea,0xf1,0x51,0xa1,0x12,0x94,0x0d,0x42};
    mont256_from_bytes(&ctx, multiplier, multiplier60);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product60, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier61[32] = {0x84,0x4a,0x70,0x34,0xe7,0x7f,0xfe,0x48,0xd0,0xa6,0xec,0x17,0x95,0x56,0x58,0x5e,0xa9,0x97,0xf3,0x51,0x75,0x4a,0x09,0xcd,0xe5,0xcf,0xed,0xfa,0x5a,0x91,0x96,0xf0};
    std::uint8_t product61[32]    = {0xd3,0x7b,0x54,0xbe,0x88,0xf2,0x5d,0xcd,0xbf,0x16,0x00,0x10,0x16,0xfa,0x9e,0xef,0x2d,0xe3,0x81,0xe3,0xe1,0x00,0x11,0x3f,0x70,0x9a,0x0d,0x13,0xed,0x3c,0x4d,0x99};
    mont256_from_bytes(&ctx, multiplier, multiplier61);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product61, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier62[32] = {0x26,0xde,0xbf,0xdb,0x88,0x25,0xae,0x56,0x21,0x79,0xb3,0x7d,0x80,0x6c,0x10,0xb5,0xe0,0xcf,0xab,0x4c,0xea,0xef,0xc4,0xd2,0xd3,0xbf,0x6d,0x01,0x6b,0xae,0x4b,0x5b};
    std::uint8_t product62[32]    = {0x19,0x75,0xf2,0xc3,0x71,0x80,0x72,0x92,0x64,0xbf,0x89,0xee,0x53,0xdb,0xd0,0x68,0x3c,0x94,0x4d,0x9d,0x5f,0xea,0xe1,0xac,0x3a,0xe9,0x4f,0x6e,0x1a,0xb3,0x77,0x2f};
    mont256_from_bytes(&ctx, multiplier, multiplier62);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product62, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier63[32] = {0x9b,0xca,0x3c,0xb7,0x2e,0xe0,0x28,0x9d,0xc6,0xc9,0x1b,0x92,0x70,0xac,0x06,0xac,0xdf,0x70,0x30,0x17,0x04,0xc9,0xd7,0x8d,0x82,0xb3,0x35,0x99,0x86,0x04,0x87,0x19};
    std::uint8_t product63[32]    = {0x12,0xa8,0x62,0x7d,0x20,0xe9,0x55,0x7e,0xd6,0x61,0xaf,0x05,0xf9,0x29,0xf6,0x3d,0x83,0x64,0x3b,0x0f,0x69,0xe5,0x4c,0x30,0xc3,0x91,0xcb,0x91,0x52,0x12,0xeb,0x0c};
    mont256_from_bytes(&ctx, multiplier, multiplier63);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product63, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier64[32] = {0x9e,0x7d,0x6b,0x37,0x79,0x36,0xd5,0x36,0x24,0x3d,0x35,0x70,0x2c,0x1e,0xea,0x1f,0x26,0x59,0x74,0xa7,0xcc,0x96,0x6f,0x46,0xc6,0xaa,0x7d,0x55,0x01,0x01,0xb8,0x11};
    std::uint8_t product64[32]    = {0x3a,0x65,0xca,0x9f,0x8b,0xda,0x0a,0x63,0xb4,0x73,0xb7,0x78,0xad,0x7f,0x9a,0x6c,0xcd,0x28,0xb1,0xe5,0xa4,0x43,0x57,0xe2,0x97,0xe9,0x83,0xb8,0x42,0xf6,0x95,0x4c};
    mont256_from_bytes(&ctx, multiplier, multiplier64);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product64, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier65[32] = {0x87,0xdd,0xae,0xb7,0x84,0xb2,0x80,0x54,0xae,0xad,0x44,0xb0,0x53,0x73,0x90,0xe5,0x0f,0xcf,0x31,0xca,0x8e,0x75,0x2f,0xdf,0x1e,0xce,0x61,0x5d,0xb9,0xa6,0x44,0x2e};
    std::uint8_t product65[32]    = {0xca,0x8c,0xfd,0x13,0xe3,0x0e,0xae,0x4c,0xa4,0x1f,0x7e,0xb4,0xca,0x92,0xa7,0xe4,0xdb,0x15,0x36,0xc9,0xf7,0xaa,0x30,0xaa,0xbb,0xcd,0x79,0x48,0xb0,0x0a,0xfb,0x58};
    mont256_from_bytes(&ctx, multiplier, multiplier65);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product65, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier66[32] = {0x0e,0x8b,0xec,0x94,0x8f,0x6f,0x91,0x5f,0xe2,0x1b,0x37,0xca,0x1b,0x29,0xfc,0x99,0xc6,0xc8,0x0e,0x2b,0xc8,0xc6,0x14,0xb2,0x7b,0x84,0x44,0xd1,0x8e,0x31,0x70,0x41};
    std::uint8_t product66[32]    = {0xbb,0x91,0xba,0x75,0x72,0x81,0x71,0x01,0xe0,0xe1,0x60,0x7b,0x02,0xe6,0x89,0x34,0xda,0xfd,0x38,0x85,0x0b,0xa1,0xa9,0xaf,0x1f,0x3e,0xd0,0x24,0x03,0x5c,0xb3,0xc3};
    mont256_from_bytes(&ctx, multiplier, multiplier66);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product66, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier67[32] = {0x73,0xc1,0xcd,0x2c,0x81,0xf9,0x8b,0x52,0x19,0x05,0xd5,0x91,0xc5,0xb2,0xe7,0x5a,0x0a,0xcd,0x8b,0xe1,0x46,0xe4,0x09,0x90,0x30,0xf9,0x70,0x58,0x3f,0x9d,0x52,0xf9};
    std::uint8_t product67[32]    = {0xe2,0x38,0x88,0x79,0xd1,0xfe,0x9d,0xc6,0x90,0xff,0x0a,0x8e,0x42,0x12,0xba,0xef,0xe6,0x56,0x05,0x7e,0x73,0xf8,0xfb,0x2d,0x2e,0xd4,0x0f,0x51,0xa4,0xbe,0xcd,0xa7};
    mont256_from_bytes(&ctx, multiplier, multiplier67);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product67, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier68[32] = {0x53,0x5b,0x6a,0x43,0x71,0x78,0xba,0x0a,0x10,0x38,0xf0,0xb5,0xe9,0x98,0xd0,0xee,0xe4,0xdd,0xf9,0xb9,0xc2,0x8e,0xe9,0x07,0x07,0x22,0x35,0xc2,0x8f,0xcd,0x7f,0x40};
    std::uint8_t product68[32]    = {0x90,0x6e,0xc9,0xc5,0x51,0xe8,0x85,0xfe,0x78,0x8f,0x9a,0x40,0xff,0xe4,0x89,0x8f,0xc9,0x5f,0xf9,0x17,0x6a,0xfe,0xf9,0x2f,0xc6,0x6f,0x56,0xbd,0xf2,0xae,0xab,0x2f};
    mont256_from_bytes(&ctx, multiplier, multiplier68);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product68, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier69[32] = {0x46,0xf5,0xa1,0xb4,0xb1,0x56,0xd1,0xad,0x33,0x0c,0x16,0xa3,0x83,0x1d,0x03,0xbf,0x9b,0x2b,0xd6,0xc0,0x81,0x6b,0xee,0x06,0xf9,0x2e,0x23,0x39,0x9c,0xce,0xa0,0x98};
    std::uint8_t product69[32]    = {0xc0,0xca,0x73,0x89,0x4f,0x7e,0x72,0x5f,0xeb,0x32,0x33,0x85,0x76,0x3e,0x54,0x5d,0x5c,0xfa,0xee,0xfd,0x03,0xb5,0x45,0x65,0x6d,0x5f,0x09,0x54,0x8b,0xdd,0x40,0xbf};
    mont256_from_bytes(&ctx, multiplier, multiplier69);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product69, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier70[32] = {0x3f,0x66,0x5e,0xde,0xf1,0x06,0x37,0xce,0x81,0xfc,0x06,0x9e,0x7a,0x60,0x96,0x83,0xce,0xaf,0x49,0x15,0x88,0x85,0x64,0xe8,0x82,0x16,0x85,0x8f,0x73,0xcc,0xef,0x03};
    std::uint8_t product70[32]    = {0x1c,0x31,0xeb,0xa4,0x61,0x41,0xba,0x4c,0x1a,0x26,0x92,0x51,0xd7,0xcf,0xb0,0xe3,0x3f,0x9f,0xf5,0x53,0x63,0x36,0xb6,0xa3,0xf1,0xc8,0x63,0x73,0xe7,0x32,0x0e,0x2c};
    mont256_from_bytes(&ctx, multiplier, multiplier70);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product70, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier71[32] = {0xec,0x3b,0x96,0x05,0x42,0x74,0xa3,0xeb,0xed,0x84,0xe9,0x1e,0xf1,0x32,0xbf,0x2d,0xe0,0x40,0x01,0x5c,0xe0,0x64,0xa1,0x14,0x85,0xf1,0x11,0x5b,0xb2,0xff,0xf1,0x7b};
    std::uint8_t product71[32]    = {0x6c,0x37,0x4b,0x19,0x97,0x30,0xf4,0x03,0x77,0x81,0x43,0xc3,0x83,0x73,0x29,0xdf,0xa1,0xf5,0x17,0x7b,0x23,0x0d,0x0e,0x91,0xdf,0x1b,0x4e,0xe3,0x1c,0xf9,0xc2,0x09};
    mont256_from_bytes(&ctx, multiplier, multiplier71);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product71, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier72[32] = {0x6a,0xa8,0xb9,0xe0,0x23,0x1b,0x3e,0x14,0x72,0x91,0x35,0xbd,0xd7,0x0a,0x39,0xd1,0x33,0xdc,0xd7,0x7f,0xf1,0x79,0xf2,0xd2,0xe4,0x8b,0x96,0x62,0x8f,0x3c,0x4b,0xe3};
    std::uint8_t product72[32]    = {0x1a,0x38,0xf7,0xe0,0x1f,0x44,0x4c,0x66,0x4f,0x92,0xd9,0x55,0xe3,0x3e,0x20,0x90,0xa2,0xd1,0x54,0x02,0x93,0x14,0x9d,0xe4,0xa1,0x4f,0xc6,0x51,0x2f,0x7c,0x7d,0x74};
    mont256_from_bytes(&ctx, multiplier, multiplier72);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product72, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier73[32] = {0x6d,0xa7,0x9a,0x87,0x3d,0x9a,0x80,0x79,0xab,0xd0,0xd7,0xfb,0x12,0x92,0x61,0x85,0x50,0xe4,0x0d,0x54,0x71,0x2e,0xa6,0xb3,0x64,0x71,0xfd,0xe4,0x1f,0x22,0x9d,0xd0};
    std::uint8_t product73[32]    = {0xf6,0x14,0xeb,0x57,0xa9,0xc9,0x5a,0x4e,0xc0,0xc9,0xff,0xe1,0xc4,0x93,0x8c,0x59,0xe0,0x1a,0xae,0x63,0xd6,0x21,0x19,0xbb,0x60,0xcb,0xf4,0x39,0x0c,0xa9,0x56,0x6f};
    mont256_from_bytes(&ctx, multiplier, multiplier73);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product73, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier74[32] = {0xc6,0xe5,0x0d,0xf2,0xe5,0xa3,0x86,0x3e,0x1f,0x52,0x52,0x65,0xc8,0xb0,0x07,0xee,0x4d,0x82,0xfe,0xac,0xab,0x62,0x86,0xcd,0x36,0x72,0xd6,0xae,0x12,0xb8,0x0a,0xed};
    std::uint8_t product74[32]    = {0xba,0x60,0x64,0x68,0x3f,0xc3,0x75,0xb7,0x29,0x49,0x01,0xd7,0x58,0x99,0xb5,0x8b,0xe9,0x28,0x87,0xc9,0x26,0x80,0x58,0x7d,0xba,0x34,0x54,0xef,0xf3,0x63,0xb6,0x21};
    mont256_from_bytes(&ctx, multiplier, multiplier74);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product74, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier75[32] = {0x40,0xcb,0xac,0xd0,0x24,0x9a,0x45,0x84,0x5d,0xbe,0x30,0x23,0xa9,0x06,0x92,0x2f,0xa4,0xb9,0xa9,0xc4,0xb7,0x53,0xa1,0xee,0xf0,0x83,0x60,0x85,0x27,0x89,0xd0,0x59};
    std::uint8_t product75[32]    = {0xed,0xbb,0xab,0x91,0x89,0x4f,0x9d,0xc5,0x02,0xd7,0x08,0xb0,0x31,0xdd,0x4b,0xd0,0x65,0xcd,0x1e,0xbc,0x41,0x79,0x2c,0xab,0xb6,0xee,0xe1,0x0f,0x04,0xdb,0x44,0x94};
    mont256_from_bytes(&ctx, multiplier, multiplier75);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product75, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier76[32] = {0x18,0x18,0x9a,0xf4,0xf3,0xd7,0x4f,0x82,0xbf,0x26,0x8e,0xa0,0x38,0x36,0xe8,0x65,0x77,0xbd,0x89,0x1f,0xf7,0xb1,0x03,0xdf,0x23,0x23,0x1e,0x1e,0xe2,0x01,0x55,0x22};
    std::uint8_t product76[32]    = {0x5a,0x25,0xa2,0x5c,0x3b,0x12,0x05,0xc3,0x64,0x7e,0x5e,0xfe,0x04,0x7b,0x37,0x1d,0x34,0x03,0x64,0x8d,0x1c,0x7a,0x37,0xb0,0xa3,0x56,0x8b,0xeb,0x36,0xdc,0xdb,0x1c};
    mont256_from_bytes(&ctx, multiplier, multiplier76);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product76, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier77[32] = {0x39,0x45,0x33,0x6b,0xd5,0x1b,0x18,0x15,0xaa,0xf7,0x19,0xf3,0xfd,0x68,0x37,0x3b,0x29,0xac,0xf1,0xa5,0x7c,0xbd,0x1f,0x5a,0xe2,0x8a,0xf6,0x04,0x65,0xf4,0x29,0x86};
    std::uint8_t product77[32]    = {0x79,0x2a,0x98,0xf0,0x27,0x08,0x7b,0x8d,0x9c,0xb4,0xfb,0x5d,0xbc,0xdd,0xc3,0x39,0x59,0xe9,0x95,0xc4,0xb2,0x6f,0xbd,0xd3,0x11,0xbb,0xc5,0x17,0x3c,0xc3,0x10,0xb0};
    mont256_from_bytes(&ctx, multiplier, multiplier77);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product77, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier78[32] = {0x6b,0xd8,0xc6,0x76,0x56,0xd0,0x50,0xcd,0x67,0x60,0x13,0x67,0x83,0xfe,0xb1,0x7b,0xfe,0x7b,0x8a,0xe4,0x6e,0x78,0x36,0xa4,0xb4,0xd1,0x9e,0xc1,0x29,0x55,0xd6,0xf0};
    std::uint8_t product78[32]    = {0x4d,0x34,0x87,0x89,0x36,0xc0,0xee,0x13,0x03,0x08,0xb5,0xd5,0x3a,0xcd,0xcc,0xc7,0xae,0xf2,0xe1,0x14,0xf3,0x66,0x01,0x02,0xb9,0x11,0xa4,0xea,0x3a,0x0f,0x9a,0x11};
    mont256_from_bytes(&ctx, multiplier, multiplier78);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product78, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier79[32] = {0x56,0x85,0xd6,0x24,0x04,0xfc,0xd5,0x55,0x5d,0xaf,0x10,0x6d,0xb8,0xde,0xe0,0x81,0x17,0x9a,0x07,0x1e,0x51,0x8a,0xe4,0x52,0x5b,0x4b,0x1b,0x75,0x32,0x1c,0x52,0x96};
    std::uint8_t product79[32]    = {0xf8,0x5a,0x46,0x8e,0xb9,0x59,0x64,0xec,0x7e,0x58,0xc0,0xe9,0x0b,0xdc,0xf4,0x6f,0x7f,0xec,0x42,0x0a,0x7c,0x9f,0x79,0x95,0x40,0xa5,0x36,0x95,0xff,0xb4,0x46,0x7a};
    mont256_from_bytes(&ctx, multiplier, multiplier79);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product79, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier80[32] = {0x84,0x76,0x8b,0x8c,0x54,0xdd,0x0b,0xa5,0x62,0x64,0x67,0xba,0x04,0xa1,0x05,0x47,0xb4,0x01,0xba,0x85,0x70,0xc1,0xdc,0xa1,0x75,0x6b,0x72,0x89,0x8d,0xd6,0x3c,0xb9};
    std::uint8_t product80[32]    = {0xcc,0x15,0x03,0x67,0x21,0x03,0xa4,0x64,0x7b,0x6a,0x2f,0x19,0xd3,0x81,0x33,0x20,0xd8,0x34,0x51,0x39,0xc4,0x19,0xdc,0x20,0xf0,0x57,0x82,0x7c,0xf6,0xac,0xd5,0x65};
    mont256_from_bytes(&ctx, multiplier, multiplier80);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product80, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier81[32] = {0xeb,0x25,0xf8,0xa1,0xfc,0x2e,0x6a,0x59,0x1c,0xe3,0xbc,0x0c,0x10,0x75,0x5c,0x97,0xf5,0xf5,0x54,0xed,0x83,0x23,0x9e,0xf5,0x4b,0xa2,0xe1,0x61,0x9f,0xb9,0xaf,0x50};
    std::uint8_t product81[32]    = {0xde,0x6d,0x28,0x8d,0x2d,0x03,0x99,0x48,0x3b,0x93,0x1f,0x6d,0xc5,0x98,0x25,0x0d,0x02,0x74,0x30,0x63,0xd2,0xb4,0x32,0x44,0xe9,0x51,0xdb,0x40,0x8c,0x1e,0x6a,0x03};
    mont256_from_bytes(&ctx, multiplier, multiplier81);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product81, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier82[32] = {0x45,0x9c,0x94,0x5c,0x43,0xfc,0x05,0x27,0x15,0x85,0x0a,0x03,0x1a,0xd2,0xd5,0xf1,0xe0,0x5b,0x3e,0x13,0xf8,0xc1,0x10,0xfb,0x3a,0x82,0x81,0x59,0xc9,0xd2,0x29,0x50};
    std::uint8_t product82[32]    = {0x6c,0x61,0x70,0x28,0x86,0xa5,0xac,0x7d,0x1f,0x80,0x5d,0x28,0x3b,0xbb,0xe1,0xe2,0xe0,0x11,0x49,0xe8,0xf5,0xe7,0x88,0x82,0xc6,0x51,0xa7,0x15,0x30,0x8e,0xc3,0x9b};
    mont256_from_bytes(&ctx, multiplier, multiplier82);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product82, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier83[32] = {0xd1,0xdc,0xec,0x53,0x21,0x2a,0x8d,0x9b,0xc1,0x7a,0x92,0x62,0x45,0x3b,0xf4,0x91,0x2e,0x7a,0x26,0xe9,0xc7,0x6c,0x60,0x3f,0xe7,0xe8,0xf9,0xf6,0x0a,0x22,0x73,0x85};
    std::uint8_t product83[32]    = {0xeb,0xef,0x31,0x9e,0xe9,0x74,0x46,0xf0,0x35,0x4a,0x15,0x92,0x60,0x81,0x36,0xfa,0xa8,0x12,0x88,0xd2,0xc2,0xb5,0x6c,0x4b,0xcc,0x49,0x8a,0xf4,0x7c,0x5f,0x4e,0xaa};
    mont256_from_bytes(&ctx, multiplier, multiplier83);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product83, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier84[32] = {0x67,0xec,0x32,0x6a,0x42,0x34,0x33,0x54,0xf2,0x2d,0x28,0x82,0xd1,0xa8,0x9b,0x37,0xad,0x0c,0x9b,0xb6,0xe9,0x52,0x6a,0x69,0xd9,0x7e,0x96,0x7b,0x6c,0x18,0xd9,0x82};
    std::uint8_t product84[32]    = {0x2e,0xec,0x5b,0xcf,0x88,0x44,0xa2,0xa1,0xc1,0x60,0xa5,0xb8,0x20,0xc5,0x2d,0x35,0x88,0x99,0xab,0x60,0xc0,0x6f,0xfe,0x79,0x0a,0x7c,0xe8,0x08,0x2f,0x9a,0xd2,0xd5};
    mont256_from_bytes(&ctx, multiplier, multiplier84);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product84, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier85[32] = {0x53,0xb9,0x73,0x77,0xb3,0x4e,0x8e,0xce,0x7e,0x9e,0xe5,0x1d,0x92,0x12,0x82,0x4c,0x83,0xc8,0xcb,0x28,0xeb,0x4e,0xd2,0xe3,0x89,0x5e,0x8b,0x6b,0x26,0x3c,0xfa,0x5e};
    std::uint8_t product85[32]    = {0x54,0x76,0x05,0xf2,0x67,0x71,0xde,0x8b,0x54,0xce,0x11,0xed,0x56,0xb5,0xe3,0x08,0xb9,0xe9,0xcb,0x7e,0x9d,0xf5,0xb8,0xa7,0x38,0xda,0xcb,0x9a,0x52,0x89,0x5b,0xe5};
    mont256_from_bytes(&ctx, multiplier, multiplier85);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product85, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier86[32] = {0xe5,0x31,0x69,0x60,0x6c,0xe1,0x93,0xc2,0x2e,0xef,0xa2,0x79,0xb0,0x2e,0x3d,0x8d,0xcc,0xb1,0xc5,0x1d,0x0e,0xba,0x0e,0xa8,0x47,0x70,0xa0,0x87,0x16,0xe6,0xfe,0xc3};
    std::uint8_t product86[32]    = {0x74,0xc7,0x0c,0x95,0x84,0x85,0x98,0x62,0x7a,0xfa,0x61,0xb7,0xf8,0xb0,0x51,0xfe,0x0e,0x27,0xa7,0xea,0x99,0x8d,0xb5,0xf7,0x7f,0x20,0x9f,0x3c,0xa1,0x54,0xc6,0x81};
    mont256_from_bytes(&ctx, multiplier, multiplier86);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product86, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier87[32] = {0x42,0xb3,0x87,0x55,0xcd,0x37,0x88,0x0e,0x16,0xac,0x41,0x91,0xa2,0x6a,0xa0,0xae,0x04,0x4f,0x15,0x74,0xf0,0x37,0xaf,0xc6,0x44,0xd8,0x2a,0x53,0x12,0x89,0xba,0xfa};
    std::uint8_t product87[32]    = {0xcb,0xea,0xec,0x84,0x14,0x56,0x68,0x33,0x0a,0x89,0x73,0x64,0x0f,0x2a,0x7f,0x50,0xf0,0x80,0x6d,0x35,0x4c,0x6c,0x68,0xa3,0xfc,0xd9,0x24,0xd9,0x2a,0xec,0x31,0x73};
    mont256_from_bytes(&ctx, multiplier, multiplier87);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product87, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier88[32] = {0x1f,0x26,0x42,0xaa,0xdc,0xde,0xd2,0x04,0x43,0xb3,0x0f,0x66,0x11,0x0e,0x2c,0xb6,0x38,0xef,0xba,0xeb,0xdb,0x31,0xcc,0xd2,0x9b,0xb1,0x83,0xe1,0x15,0x70,0x26,0x6b};
    std::uint8_t product88[32]    = {0xe6,0x45,0xf3,0x48,0xec,0xf1,0x8b,0x01,0xc0,0x95,0x7d,0xff,0x6a,0x53,0x3d,0x1f,0x96,0xe0,0x00,0x1d,0xa8,0x03,0x2c,0x00,0x0a,0xe8,0xbd,0x39,0x9f,0x94,0x92,0xc2};
    mont256_from_bytes(&ctx, multiplier, multiplier88);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product88, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier89[32] = {0xea,0x59,0x67,0x9a,0xed,0x3a,0x32,0xa8,0x6a,0xf2,0x57,0x48,0x8d,0x95,0x9c,0x31,0xfe,0x8a,0xd4,0xa1,0x56,0xd2,0xa6,0x8c,0x02,0xf4,0xb3,0x42,0x74,0x2a,0x80,0x63};
    std::uint8_t product89[32]    = {0xf7,0x8f,0x10,0x08,0xba,0x56,0x27,0x58,0xb1,0x0a,0xb3,0xb5,0xda,0x07,0xe4,0xcd,0x04,0x98,0x91,0xde,0x80,0x75,0x60,0xf8,0x48,0xc7,0x32,0x1c,0xbb,0x1b,0x34,0xe4};
    mont256_from_bytes(&ctx, multiplier, multiplier89);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product89, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier90[32] = {0xf0,0x29,0x05,0x31,0x3d,0x0a,0x27,0x0b,0xb5,0xa4,0x32,0xcf,0x86,0xe3,0xe7,0x26,0x0b,0x0f,0x87,0x3b,0x21,0x14,0xe0,0x68,0x9f,0x27,0xf5,0x2c,0x44,0x92,0x74,0xd2};
    std::uint8_t product90[32]    = {0xaf,0x1c,0xdd,0x88,0x6f,0x00,0xd3,0x93,0xad,0x11,0xe4,0xc7,0x00,0xbd,0x14,0xc8,0x84,0x7c,0x54,0x16,0x61,0x1f,0xdd,0xca,0x8a,0xc7,0x2f,0x2d,0x6f,0xa9,0x44,0x3a};
    mont256_from_bytes(&ctx, multiplier, multiplier90);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product90, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier91[32] = {0xee,0xa7,0xbb,0x64,0x33,0xa7,0x15,0x68,0x2e,0x5f,0x95,0x0c,0x0c,0xe5,0xaf,0x69,0x43,0x0b,0x91,0xed,0x29,0x54,0xba,0x5c,0xf8,0x1e,0x54,0xdd,0x1c,0x05,0x02,0xc6};
    std::uint8_t product91[32]    = {0x83,0xc4,0x21,0x39,0x0f,0x3f,0x72,0x25,0x8b,0xe3,0x6a,0xb9,0x8e,0x3e,0xc3,0x14,0xf0,0x23,0xe2,0x68,0x8a,0x1e,0x7e,0x6f,0x5d,0xcc,0x30,0x0b,0x16,0x71,0xdf,0xb6};
    mont256_from_bytes(&ctx, multiplier, multiplier91);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product91, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier92[32] = {0x72,0x18,0x88,0xff,0x4a,0x3a,0xdf,0x99,0x34,0xb3,0xff,0x60,0xc2,0x6e,0x7a,0x42,0x87,0xf5,0x3d,0xdd,0x4e,0x14,0xd5,0x71,0xa0,0xf0,0x96,0xda,0x4f,0xde,0xbb,0xec};
    std::uint8_t product92[32]    = {0x67,0xff,0x42,0x85,0x20,0xcc,0x01,0x2e,0x43,0xee,0xe0,0xf6,0x57,0x7d,0x4d,0x85,0xa3,0x8e,0xcc,0xd1,0xf2,0x5d,0x67,0xa1,0x0e,0x4c,0x21,0x5a,0xa9,0x91,0x52,0x8a};
    mont256_from_bytes(&ctx, multiplier, multiplier92);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product92, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier93[32] = {0xfe,0x97,0x7c,0x56,0x04,0xa6,0x56,0x51,0xcd,0xbd,0xe7,0x47,0x58,0xd5,0x0f,0x1b,0x45,0x40,0xf4,0x26,0x2d,0x8a,0xd8,0xc0,0xac,0x12,0x7e,0x93,0x80,0x05,0xce,0x74};
    std::uint8_t product93[32]    = {0xba,0x09,0xa4,0x7f,0x0c,0x50,0x0d,0x94,0xb5,0x3c,0x2c,0x45,0x6e,0x96,0x9d,0x3b,0x2a,0x0a,0xb1,0x8f,0x28,0xf9,0xe3,0x34,0x4c,0x85,0x24,0xd5,0x7b,0x3a,0x3d,0x3b};
    mont256_from_bytes(&ctx, multiplier, multiplier93);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product93, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier94[32] = {0xfa,0x61,0x97,0x74,0x8d,0x11,0x8e,0x37,0x81,0x72,0x8a,0x07,0xbb,0xab,0x27,0xf6,0x04,0xb8,0x15,0x7d,0x03,0xed,0xb9,0x20,0x09,0x75,0x83,0x40,0x40,0x1d,0x68,0xfb};
    std::uint8_t product94[32]    = {0xcc,0x54,0x36,0xe4,0xa9,0x89,0xa1,0x12,0x46,0xeb,0x2a,0x31,0xe6,0x55,0x96,0x1d,0xe4,0xd6,0xe3,0xe3,0x16,0x7d,0x2e,0xa0,0x9f,0x32,0x0f,0x8f,0x69,0x8f,0x19,0xbd};
    mont256_from_bytes(&ctx, multiplier, multiplier94);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product94, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier95[32] = {0xa8,0x87,0xae,0x22,0x1b,0x35,0x41,0x1b,0x72,0x72,0x3b,0x9c,0xef,0x44,0xc0,0xd5,0x3e,0xe4,0xda,0x5a,0x79,0x89,0xe9,0xd0,0x83,0xa4,0xe6,0x29,0x30,0x80,0x38,0x89};
    std::uint8_t product95[32]    = {0x1e,0x57,0x76,0x72,0xaa,0x66,0x7f,0x37,0x44,0x84,0x4a,0x8f,0x21,0x80,0xec,0xc4,0xad,0x68,0xc4,0x65,0x42,0xac,0x13,0x24,0x29,0x08,0xee,0x62,0x99,0xe9,0x4f,0x62};
    mont256_from_bytes(&ctx, multiplier, multiplier95);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product95, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier96[32] = {0xe3,0x83,0x8b,0x9e,0xd5,0xa9,0x42,0x2a,0x8b,0xc0,0x83,0x11,0x7e,0xb8,0x6c,0x57,0xa8,0x11,0x00,0xa1,0x6e,0xa3,0x30,0xa1,0xa6,0x6d,0x58,0xb5,0xd1,0xa4,0xc0,0x1e};
    std::uint8_t product96[32]    = {0x57,0x9f,0x1e,0xac,0xff,0x20,0x89,0xf3,0x39,0xbb,0x0a,0x90,0xde,0x99,0xd7,0x12,0xd9,0xe1,0xe3,0xaa,0xb4,0x0f,0x4a,0xe4,0xa0,0xd5,0x7d,0x4c,0x16,0x54,0xc1,0xd7};
    mont256_from_bytes(&ctx, multiplier, multiplier96);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product96, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier97[32] = {0x3a,0xc4,0xda,0x9a,0xfb,0x81,0x39,0x21,0x37,0x16,0x1c,0x16,0xb0,0x0f,0xd7,0xbb,0x4e,0xca,0xde,0xa2,0x81,0xb6,0x2b,0xb5,0xf8,0x66,0x64,0xae,0x64,0xa1,0x49,0xf5};
    std::uint8_t product97[32]    = {0x6b,0x96,0x15,0x30,0xac,0x6e,0xdf,0x15,0xdb,0xb2,0x4c,0x33,0xed,0x95,0x18,0xd9,0x06,0xc8,0xf1,0x2e,0x5c,0x30,0xf5,0xa9,0xe7,0x23,0x3c,0xee,0x72,0x12,0x54,0x1c};
    mont256_from_bytes(&ctx, multiplier, multiplier97);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product97, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier98[32] = {0x23,0xc4,0x9c,0xae,0xa2,0xcf,0x62,0xba,0xba,0x95,0x88,0x10,0xb4,0xeb,0xf4,0xb6,0xe1,0xc6,0x0a,0xa3,0xd5,0x10,0xbb,0x04,0x32,0xd9,0x0d,0xcd,0x57,0xbb,0x7d,0x97};
    std::uint8_t product98[32]    = {0x02,0x50,0x08,0x73,0xdc,0x0e,0xb9,0x03,0xd3,0x56,0x8d,0xca,0xf9,0xea,0x34,0x59,0xd0,0x36,0xd9,0xb5,0xaa,0x6c,0x6a,0xf8,0x3b,0x9d,0x5a,0x93,0x4f,0xf8,0xa2,0x30};
    mont256_from_bytes(&ctx, multiplier, multiplier98);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product98, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
    std::uint8_t multiplier99[32] = {0x03,0xa6,0x39,0x66,0x21,0x3b,0xca,0x7f,0xd6,0x44,0xde,0x2f,0x0d,0xec,0x68,0x23,0xfb,0x5c,0x9d,0x56,0x58,0xf9,0x2d,0xea,0xfd,0x4b,0xd0,0x30,0x67,0x9a,0x44,0xdd};
    std::uint8_t product99[32]    = {0x15,0xbd,0x0c,0x76,0xc4,0x29,0x26,0x2d,0x7f,0xe2,0xce,0x8e,0xb0,0x3b,0xec,0x4c,0x16,0x9a,0xa9,0x8c,0xa7,0xfc,0xda,0xca,0xe0,0x59,0x65,0x2f,0x33,0xec,0xfd,0xc8};
    mont256_from_bytes(&ctx, multiplier, multiplier99);
    mont256_sqr(&ctx, product, multiplier);
    mont256_to_bytes(&ctx, product_data, product);
    if (std::memcmp(product99, product_data, 32) != 0)
    {
        throw std::runtime_error("err in mont256_sqr");
    }
}
